/**
 * Created by lx on 17/6/8.
 */

define(['text!style/details.css', 'text!module/details/details.html'], function (css, tpl) {

    var controller = function () {
        document.getElementsByTagName("style")[0].innerHTML = css;
        appView.html(tpl);
        $("#details-nav").on('touchstart', function(e) {
            var dataCat = e.target.getAttribute('data-cat');
            e.target.className = 'active';
            $(e.target).siblings().removeClass('active');
            // e.target.nextSibling.setAttribute('class', '');
            if (e.target.nodeName == 'LI') {
                if (dataCat == 'JJ') {
                    $("#details-con").html('简介');

                } else if (dataCat == 'JY') {
                    $("#details-con").html('经营');
                } else if (dataCat == 'ZZ') {
                    $("#details-con").html('资质');
                }
            }
        });
    };
    return controller;
});